import csv,sys,random

assert sys.argv[1] != sys.argv[2]

matrixreader = csv.reader(open(sys.argv[1],'r'),delimiter='\t')
matrixwriter = csv.writer(open(sys.argv[2],'w'),delimiter='\t')

matrixwriter.writerow(matrixreader.next())

for line in matrixreader:
    header = line.pop(0)
    #print line[0:5],'\n',
    random.shuffle(line)
    #print line[0:5],'\n',
    line.insert(0,header)
    matrixwriter.writerow(line)
